<?php
/**
 * 公共资源服务
 * Created by Tinico
 */
class apiAction extends Action {
    
    private $dao;
    
    public function _initialize() {
        parent::_initialize();
        $this->dao = M('classsys');
    }
	
	public function district() {
        $dist = intval($_GET['dist']);
        
        $field = array(
            'classsys0' => 'id',
            'classsys1' => 'name',
            'classsys2' => 'parent',
            'classsys4' => 'order'
        );
        $condition['classsys3'] = 590;
        $condition['classsys0'] = $dist;
        
        M('classsys')->
        
    }
    
    //查找节点路径
    public function getRoot($nodeId, &$path) {
        //查找父ID
        $node = $this->dao
            ->field(array('classsys0'=>'id'))
            ->where('classsys0='.$nodeId)
            ->find();
        $parentId = $node['classsys2'];
        //父ID为0或空时即是根节点
        if(empty($parentId))
            return empty($path) ? $node['id'];
        else
            return getRoot($parentId);
            
    }
	
}

?>